#
# @lc app=leetcode.cn id=125 lang=python3
#
# [125] 验证回文串
#

# @lc code=start
class Solution:
    def isPalindrome(self, s: str) -> bool:
        s = s.lower()
        
        numStr = len(s)
        isPal = True
        lowIndex = 0
        highIndex = numStr -1
        
        while lowIndex < highIndex:
            if not(s[lowIndex].isalnum()) and not(s[lowIndex].isalpha()):
                lowIndex +=1
                continue
            if not(s[highIndex].isalnum()) and not(s[highIndex].isalpha()):
                highIndex -=1
                continue
            if s[highIndex] != s[lowIndex]:
                return False
            else:
                lowIndex +=1
                highIndex -=1
        return True
        
# @lc code=end

